package com.edu.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.api.entity.common.Code;
import com.edu.api.entity.common.ResponseDTO;
import com.edu.api.entity.common.TransitionListUtil;
import com.edu.api.entity.order.PayOrder;
import com.edu.order.service.PayOrderService;
import com.edu.order.mapper.PayOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 */
@Service
public class PayOrderServiceImpl extends ServiceImpl<PayOrderMapper, PayOrder>
    implements PayOrderService{

    @Autowired
    PayOrderMapper payOrderMapper;

    @Override
    public ResponseDTO getPayOrderIds(String userId) {
        QueryWrapper<PayOrder> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id",userId).eq("status",2).select("product_id");
        List<Integer> objects = TransitionListUtil.castList(payOrderMapper.selectObjs(queryWrapper),Integer.class);
        return new ResponseDTO(Code.GET_OK,"成功",objects);
    }

    @Override
    public ResponseDTO insertPayOrder(String OrderNo, Integer userId, Integer productId,
        String productName, BigDecimal amount,String currency, String channel, Byte status, String client_ip,
        Date createTime, String goodsOrderNo) {
        payOrderMapper.insertPayOrder(OrderNo, userId, productId, productName, amount,currency, channel, status, client_ip, createTime, goodsOrderNo);
        return null;
    }


}




